<template>
    <a-drawer
    :destroyOnClose="true"
    :title="title"
    placement="right"
    :closable="true"
    :visible="visible"
    :maskClosable="true"
    :width="600"
    @close="onClose">
      
    <div class="table-operator">
        <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({menuId:model['menuId'],systemNo:model['systemNo']},'menuButtonForm','添加')">添加</a-button>
    </div>

    <LTable
        ref="menuButtonTable"
        size="small"
        rowKey="keyId"
        :columns="columns"
        :formAttributes="formAttributes"
        :initQuery="initQuery"
        :initOrder="initOrder"
        axiosUrl="/SysMenuButtonController/page"
        :showPagination="true"
        :showQueryForm="true"
      
      >
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'menuButtonForm','详情')">编辑</a>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete({keyId:record.keyId},'/SysMenuButtonController/del','menuButtonTable')">
                  <a>删除</a>
            </a-popconfirm>

         
        </span>
      </LTable>
      <menuButtonForm ref="menuButtonForm" @close="refresh('menuButtonTable')" @ok="refresh('menuButtonTable')"></menuButtonForm> 
     

    
    </a-drawer>

</template>

<script>

import pick from 'lodash.pick'
import request from '@/utils/request'
import LTable from '@/components/lt/LTable'
import {SysMixin} from '@/mixins/SysMixin'
import menuButtonForm from './menuButtonForm'

export default {
    name:'menuButtonList',
    mixins:[SysMixin],
    components:{
       LTable,menuButtonForm
    },
    data(){
        return{
            title:'详情',
            visible:false,
            model:{},
            formAttributes:[
               
               
            ],
            initQuery:[],
            initOrder:[],
            
            columns:[
                {
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                {
                    title: '按钮编号',
                    dataIndex: 'btNo'
                },
                
                {
                    title: '按钮说明',
                    dataIndex: 'btDesc', 
                },
                
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '220px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
        }
    },
    methods:{
       
        edit (record) {
            this.visible = true;
            this.model = Object.assign({}, record);
            this.model['menuId'] = this.model['keyId']
            this.model['keyId']=null
            this.initQuery=[{field:'menuId',val:this.model["menuId"]}]
        },
       
        ok(){
            
        },
        onClose(){
           this.visible = false;
        },
    },
    created(){
        
       
    },
}
</script>